//
//  CNKIAnswerModel.m
//  CNKICommunity
//
//  Created by wei on 17/2/21.
//  Copyright © 2017年 CNKI. All rights reserved.
//

#import "CNKIAnswerModel.h"

@implementation CNKIAnswerModel
{
    CGFloat _cellHeight;
}
-(CGFloat)cellHeight
{
    if (!_cellHeight)
    {
        CGSize maxSize = CGSizeMake(SCREENWIDTH - 22, MAXFLOAT);
        CGFloat TextH = [self.WordText boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size.height;
        //CGFloat TextH = ceil(TextHfloat);
        //_TextHeight = TextH;
        
        // 获取单行时候的内容的size
        //CGSize singleSize = [self.WordText sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}];
        
        // 返回计算的行数
        //CGFloat rowNum = ceil( TextH / singleSize.height);
    
        _TextFrame = CGRectMake(11, 103, SCREENWIDTH - 22, TextH);
        
        
        if ([self.type isEqualToString:@"ispicture"])
        {
           
            _pictureFrame = CGRectMake(23, TextH  + 86 + 30, SCREENWIDTH - 2 * 15, 80);
            //60是点赞两个按钮的距离，86为头部距离，30为上下边距，10为文字和图之间的距离 41为点赞按钮的高度
            _cellHeight = TextH  + 86 + 30 + _pictureFrame.size.height + 10 + 41;
            
        }
        else
        {
            _cellHeight = TextH + 86 + 30 + 41 ;
        }
    }
    return _cellHeight;
}



@end
